import request from "@/utils/request";

export function add(data) {
  return request({
    url: "api/salesOrder/addOrSave",
    method: "post",
    data
  });
}

export function del(ids) {
  return request({
    url: "api/salesOrder/",
    method: "delete",
    data: ids
  });
}

export function edit(data) {
  return request({
    url: "api/salesOrder/addOrSave",
    method: "post",
    data
  });
}

export function passOrReject(data) {
  const obj = {
    url: "api/salesOrder/passOrReject",
    method: "post",
    data
  };
  return request(obj);
}

export function enableOrDisable(data) {
  const obj = {
    url: "api/salesOrder/passOrReject",
    method: "post",
    data
  };
  return request(obj);
}

export function accept(data) {
  const obj = {
    url: "api/salesOrder/accept",
    method: "post",
    data
  };
  return request(obj);
}
export function copy(data) {
  const obj = {
    url: "api/salesOrder/copy",
    method: "post",
    data
  };
  return request(obj);
}

export function copyToReturn(data) {
  const obj = {
    url: "api/salesOrder/copyToReturn",
    method: "post",
    data
  };
  return request(obj);
}

export function detail(data) {
  const obj = {
    url: "api/salesOrder/detail",
    method: "get",
    data
  };
  return request(obj);
}

export function directConfigStock(data) {
  const obj = {
    url: "api/salesOrder/directConfigStock",
    method: "post",
    data
  };
  return request(obj);
}

export function exportDe(data) {
  const obj = {
    url: "api/salesOrder/export",
    method: "get",
    data
  };
  return request(obj);
}

export function exportDetail(data) {
  const obj = {
    url: "api/salesOrder/exportDetail",
    method: "post",
    data
  };
  return request(obj);
}

export function history(data) {
  const obj = {
    url: "api/salesOrder/history",
    method: "post",
    data
  };
  return request(obj);
}
export function importDe(data) {
  const obj = {
    url: "api/salesOrder/import",
    method: "post",
    data
  };
  return request(obj);
}

export function lockStock(data) {
  const obj = {
    url: "api/salesOrder/lockStock",
    method: "post",
    data
  };
  return request(obj);
}

export function removeDetail(data) {
  const obj = {
    url: "api/salesOrder/removeDetail",
    method: "post",
    data
  };
  return request(obj);
}

export function split(data) {
  const obj = {
    url: "api/salesOrder/split",
    method: "post",
    data
  };
  return request(obj);
}

export function superPass(data) {
  const obj = {
    url: "api/salesOrder/superPass",
    method: "post",
    data
  };
  return request(obj);
}

export function unAccept(data) {
  const obj = {
    url: "api/salesOrder/unAccept",
    method: "post",
    data
  };
  return request(obj);
}

export function unLockStock(data) {
  const obj = {
    url: "api/salesOrder/unLockStock",
    method: "post",
    data
  };
  return request(obj);
}
export function priceInfo(data) {
  console.log("crudBasSaleSystem");
  const obj = {
    url: "api/basGoods/priceInfo",
    method: "get",
    params: data
  };
  return request(obj);
}

export function print(data) {
  const obj = {
    url: "api/salesOrder/print",
    method: "post",
    responseType: "blob",
    data
  };
  return request(obj);
}

export function emptyBox(data) {
  const obj = {
    url: "/api/salesOrder/emptyBox",
    method: "get",
    params: data
  };
  return request(obj);
}
export function batchRemoveDetail(data) {
  const obj = {
    url: "/api/salesOrder/batchRemoveDetail",
    method: "post",
    data
  };
  return request(obj);
}
export function saveAndPass(data) {
  const obj = {
    url: "/api/salesOrder/saveAndPass",
    method: "post",
    data
  };
  return request(obj);
}

export function ignorePromotionPass(data) {
  const obj = {
    url: "/api/salesOrder/ignorePromotionPass",
    method: "post",
    data
  };
  return request(obj);
}

export function getBatchDiscountInfo(data) {
  console.log("getBatchDiscountInfo", data);
  const obj = {
    url: "/api/salesOrder/getBatchDiscountInfo",
    method: "get",
    params: data,
    data
  };
  return request(obj);
}

export function batchDiscount(data) {
  const obj = {
    url: "/api/salesOrder/batchDiscount",
    method: "post",
    data
  };
  return request(obj);
}

export function superReject(data) {
  const obj = {
    url: "/api/salesOrder/superReject",
    method: "post",
    data
  };
  return request(obj);
}

export function getIndexSalesOrderInfo(data) {
  const obj = {
    url: "/api/common/getIndexSalesOrderInfo",
    method: "get",
    params: data
  };
  return request(obj);
}

export function salesOrdersyncSalesOrderAcceptInfo(data) {
  const obj = {
    url: "/api/salesOrder/syncSalesOrderAcceptInfo",
    method: "post",
    data
  };
  return request(obj);
}

export function superCancel(data) {
  const obj = {
    url: "/api/salesOrder/superCancel",
    method: "post",
    data
  };
  return request(obj);
}

export function superUnCancel(data) {
  const obj = {
    url: "/api/salesOrder/superUnCancel",
    method: "post",
    data
  };
  return request(obj);
}

export function getSalesOrderPreviousNextPageIdList(data) {
  const obj = {
    url: "/api/salesOrder/getSalesOrderPreviousNextPageIdList",
    method: "get",
    params: data
  };
  return request(obj);
}

export function checkCustomerIsExceed(data) {
  const obj = {
    url: "/api/dropDown/checkCustomerIsExceed",
    method: "get",
    params: data
  };
  return request(obj);
}

export function basGoodsListForAddWithGiftPromotion(data) {
  const obj = {
    url: "/api/dropDown/basGoodsListForAddWithGiftPromotion",
    method: "get",
    params: data
  };
  return request(obj);
}

export function giftPromotionDetail(data) {
  const obj = {
    url: "/api/dropDown/basGoodsListForAddWithGiftPromotion/detail",
    method: "get",
    params: data
  };
  return request(obj);
}

export function paperGoodsWithEmptyBoxGoodsList(data) {
  const obj = {
    url: "/api/dropDown/paperGoodsWithEmptyBoxGoodsList",
    method: "get",
    params: data
  };
  return request(obj);
}

export function recycle(data) {
  const obj = {
    url: "/api/salesOrder/recycle",
    method: "post",
    data
  };
  return request(obj);
}
export function unRecycle(data) {
  const obj = {
    url: "/api/salesOrder/unRecycle",
    method: "post",
    data
  };
  return request(obj);
}
export function append(data) {
  const obj = {
    url: "/api/salesOrder/append",
    method: "post",
    data
  };
  return request(obj);
}

export function recycleDetailList(params) {
  const obj = {
    url: "/api/salesOrder/recycleDetailList",
    method: "get",
    params
  };
  return request(obj);
}

export function feiEPrint(data) {
  const obj = {
    url: "api/salesOrder/feiEPrint",
    method: "post",
    data
  };
  return request(obj);
}

export function settlementDraw(data) {
  const obj = {
    url: "api/salesOrder/settlement/draw",
    method: "get",
    params: data
  };
  return request(obj);
}

export function settlementSave(data) {
  const obj = {
    url: "/api/salesOrder/settlement",
    method: "post",
    data
  };
  return request(obj);
}

export function onlinePayQuery(data) {
  const obj = {
    url: "api/salesOrder/onlinePayQuery",
    method: "post",
    data
  };
  return request(obj);
}

export function saveAccounting(data) {
  const obj = {
    url: "api/salesOrder/onAccount",
    method: "post",
    data
  };
  return request(obj);
}
//检查库存
export function checkBomStock(data) {
  const obj = {
    url: "api/salesOrder/checkBomStock",
    method: "post",
    data
  };
  return request(obj);
}

export function resetDetailPrint(data) {
  const obj = {
    url: "api/salesOrder/resetDetailPrintStatus",
    method: "post",
    data
  };
  return request(obj);
}
export function basWarehouseList(params) {
  const obj = {
    url: "/api/dropDown/basWarehouseList",
    method: "get",
    params
  };
  return request(obj);
}
//销售单检查原料
export function checkMaterial(data) {
  const obj = {
    url: "/api/salesOrder/checkMaterial",
    method: "post",
    data
  };
  return request(obj);
}
//缺少原材料生成采购单
export function checkMaterialAddBuyOrder(data) {
  const obj = {
    url: "/api/salesOrder/checkMaterialAddBuyOrder",
    method: "post",
    data
  };
  return request(obj);
}

export function deptJuniorUserList(params) {
  const obj = {
    url: "/api/dropDown/deptJuniorUserList",
    method: "get",
    params
  };
  return request(obj);
}

export function refundOrder(data) {
  const obj = {
    url: "/api/gateway/refund",
    method: "post",
    data
  };
  return request(obj);
}
export default {
  batchDiscount,
  getBatchDiscountInfo,
  saveAndPass,
  add,
  edit,
  del,
  passOrReject,
  enableOrDisable,
  accept,
  copy,
  copyToReturn,
  detail,
  directConfigStock,
  exportDe,
  exportDetail,
  history,
  importDe,
  lockStock,
  removeDetail,
  split,
  superPass,
  unAccept,
  unLockStock,
  priceInfo,
  print,
  emptyBox,
  superReject,
  salesOrdersyncSalesOrderAcceptInfo,
  superCancel,
  superUnCancel,
  recycle,
  unRecycle,
  append,
  recycleDetailList,
  feiEPrint,
  onlinePayQuery,
  basWarehouseList
};
